# RedFire User Service - 开发工具 Makefile
# ========================================

.PHONY: help install-tools compile-deps sync-deps security-check upgrade-deps clean-deps outdated

# 默认目标
help:
	@echo "RedFire User Service 依赖管理命令:"
	@echo ""
	@echo "  install-tools    安装 pip-tools 等依赖管理工具"
	@echo "  compile-deps     编译所有依赖文件 (.in -> .txt)"
	@echo "  sync-deps        同步开发环境依赖"
	@echo "  sync-prod        同步生产环境依赖"
	@echo "  security-check   检查依赖安全漏洞"
	@echo "  upgrade-deps     升级所有依赖"
	@echo "  clean-deps       清理依赖缓存和编译文件"
	@echo "  outdated         显示过时的依赖"
	@echo ""
	@echo "环境特定操作:"
	@echo "  compile-base     仅编译基础依赖"
	@echo "  compile-dev      仅编译开发依赖"
	@echo "  compile-test     仅编译测试依赖"
	@echo "  compile-prod     仅编译生产依赖"

# 安装依赖管理工具
install-tools:
	@echo "📦 安装依赖管理工具..."
	python scripts/manage_deps.py install-tools

# 编译所有依赖
compile-deps:
	@echo "🔨 编译所有依赖文件..."
	python scripts/manage_deps.py compile

# 编译特定环境依赖
compile-base:
	python scripts/manage_deps.py compile --env base

compile-dev:
	python scripts/manage_deps.py compile --env development

compile-test:
	python scripts/manage_deps.py compile --env testing

compile-prod:
	python scripts/manage_deps.py compile --env production

# 同步依赖
sync-deps:
	@echo "🔄 同步开发环境依赖..."
	python scripts/manage_deps.py sync --env development

sync-prod:
	@echo "🔄 同步生产环境依赖..."
	python scripts/manage_deps.py sync --env production

# 安全检查
security-check:
	@echo "🔒 执行安全检查..."
	python scripts/manage_deps.py security

# 升级依赖
upgrade-deps:
	@echo "📈 升级所有依赖..."
	python scripts/manage_deps.py upgrade

# 清理
clean-deps:
	@echo "🧹 清理依赖缓存..."
	python scripts/manage_deps.py clean

# 检查过时依赖
outdated:
	@echo "📊 检查过时依赖..."
	python scripts/manage_deps.py outdated

# 完整的开发环境设置
setup-dev: install-tools compile-deps sync-deps
	@echo "✅ 开发环境设置完成!"

# 完整的生产环境设置  
setup-prod: install-tools compile-prod sync-prod security-check
	@echo "✅ 生产环境设置完成!"

# CI/CD 管道
ci-check: security-check
	@echo "✅ CI 检查完成!"
